//
//  SCDismissAnimation.swift
//  GZWeibo007
//
//  Created by newuser on 16/1/1.
//  Copyright © 2016年 Apple. All rights reserved.
//

import UIKit

class SCDismissAnimation: NSObject, UIViewControllerAnimatedTransitioning {
    
    //转成时间
    func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
        return 0.5
    }
    
    //实现动画
    func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
        
        //获取要model出来的控制器
        let formView = transitionContext.viewForKey(UITransitionContextFromViewKey)
       
        //做动画
        UIView.animateWithDuration(transitionDuration(transitionContext), animations: { () -> Void in
                formView?.transform = CGAffineTransformMakeScale(1, 0.0001)
            }) { (_) -> Void in
                //个数系统转场完成
               transitionContext.completeTransition(true)
        }
    }

}
